import request from "@/utils/request";
import type { RequestParams, ResponseData, RobotRequestParams } from "./type";

// 机器人绑定分页列表
export const RobotList = (data: RequestParams) => {
  return request<ResponseData<RobotRequestParams>>({
    url: "/api/v1/robot/bindingPage",
    method: "post",
    data,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
//机器人状态分页列表
export const RobotStatusList = (data: RequestParams) => {
  return request<ResponseData<RobotRequestParams>>({
    url: "/api/v1/robot/statusPage",
    method: "post",
    data,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
// 新增机器人
export const addRobot = (data: RobotRequestParams) => {
  return request<ResponseData<RobotRequestParams>>({
    url: "/api/v1/robot/add",
    method: "post",
    data,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
// export const delRobot = (id: number) => {
//   return request<ResponseData<RobotRequestParams>, any>({
//     url: "/api/v1/Robot/delete",
//     method: "post",
//     data: id,
//     headers: {
//       //需要加密的请求在头部塞入标识
//       isEncrypt: 1,
//     },
//   });
// };
// 机器人表单数据
export const FormRobot = (id: number) => {
  return request<ResponseData<RobotRequestParams>>({
    url: "/api/v1/robot/form",
    method: "post",
    data: id,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
// 解绑
export const Robotunbind = (aesKeyByRsa: string) => {
  return request<ResponseData<any>>({
    url: "/api/v1/robot/unbind",
    method: "post",
    data: aesKeyByRsa,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
// 修改机器人
export const updateRobot = (data: RobotRequestParams) => {
  return request<ResponseData<RobotRequestParams>>({
    url: "/api/v1/robot/update",
    method: "post",
    data,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
export const LibraryOptions = (aesKeyByRsa: string) => {
  return request<ResponseData<any>>({
    url: "/api/v1/library/options",
    method: "post",
    data: aesKeyByRsa,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
